package com.taxshare.mybatis.pager;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@ApiModel(description = "分页对象")
@Data
public class PageInfoRequest {

	/**
	 * 每页默认的项数(10)
	 */
	public static final int DEFAULT_PAGE_ROWS = 10;

	/**
	 * 默认 第一页
	 */
	public static final int DEFAULT_CUR_PAGE_NO = 1;

	/**
	 * 当前页码
	 */
	@ApiModelProperty(value = "当前页码")
	@NotNull(message = "当前页不能为空，请重新设置")
	@Min(value = 1, message = "当前页至少要大于0，请重新设置")
	private int currentPage = DEFAULT_CUR_PAGE_NO;

	/**
	 * 每页行数
	 */
	@ApiModelProperty(value = "每页条数")
	@NotNull(message = "每页条数不能为空，请重新设置")
	@Min(value = 1, message = "当前页至少要大于0，请重新设置")
	private int pageSize = DEFAULT_PAGE_ROWS;

	@ApiModelProperty(value = "是否分页")
	private boolean pagination = true;

}
